﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TeamBuy.AccessService
{
    public class TeamBuyQuestionService : Common.ITeamBuyQuestion
    {
        public int GetQuestionCountByCity(int cityID)
        {
            int questionCount;
            questionCount = TeamBuy.AccessService.AccessHelper.GetScalar("select count(QuestionID) from C_Question WHERE CityID=" + cityID);
            return questionCount;
        }


        public bool CreateQuestion(int userID, int cityID, int dealID, string question)
        {
            int createQuestion;
            createQuestion = TeamBuy.AccessService.AccessHelper.ExecuteCommand("insert into C_Question(UserID, CityID, DealID, Question) values(" + userID + "," + cityID + "," + dealID + ",'" + question + "')");
            if (createQuestion == 1)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
